// @Author EthanScriptOn
// @Desc
package closer

import "context"

// Closer closer
type Closer struct {
	Ctx       context.Context
	CancelFun context.CancelFunc
}

func (c *Closer) Close() {
	c.CancelFun()
}

func (c *Closer) IsClose() bool {
	select {
	case <-c.Ctx.Done():
		return true
	default:
		return false
	}
}
